//
//  LogExt.h
//  LearnLib
//
//  Created by Yahaong on 16/8/15.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CocoaLumberjack.h"

extern const DDLogLevel ddlogLevel;

/**
 *  log 定义
 */

typedef NS_OPTIONS(NSInteger, YHLogFlag) {
    YHLogFlagError      = (1 << 0), // 0...00001
    YHLogFlagWarning    = (1 << 1), // 0...00010
    YHLogFlagInfo       = (1 << 2), // 0...00100
    YHLogFlagDebug      = (1 << 3), // 0...01000
    YHLogFlagVerbose    = (1 << 4)  // 0...10000
};
@interface YHLog : NSObject
+ (NSString *)logFolder;
+ (void)prepareForLogging;
/**
 * 为了自定义logerror的方式，避免ddlog在主线程打logerror
 */
+ (void)logWithFlag:(NSUInteger)flag format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3);

#define YHLogError(frmt, ...)  [YHLog logWithFlag:YHLogFlagError format:(frmt), ## __VA_ARGS__]
#define YHLogWarn(frmt, ...)   [YHLog logWithFlag:YHLogFlagWarning format:(frmt), ## __VA_ARGS__]
#define YHLogInfo(frmt, ...)   [YHLog logWithFlag:YHLogFlagInfo format:(frmt), ## __VA_ARGS__]
#define YHLogDebug(frmt, ...)  [YHLog logWithFlag:YHLogFlagDebug format:(frmt), ## __VA_ARGS__]
@end
